﻿using Firestarter.DB.Schema.BO;
using FireStarterModeller.Test;
using Habanero.Testability;

namespace Firestarter.DB.Schema.Test.BO.TestUtils
{
    public class TestUtilsDBPrimaryKeyColumn
    {
        public static BOTestFactory<DBPrimaryKeyColumn> GetTestFactory()
        {
            return BOTestFactoryRegistry.Instance.Resolve<DBPrimaryKeyColumn>();
        }

        /// <summary>
        /// Creates a new saved DBPrimaryKeyColumn with a random value assigned to every property
        /// </summary>
        public static DBPrimaryKeyColumn CreateSavedDBPrimaryKeyColumn()
        {
            DBPrimaryKeyColumn dBPrimaryKeyColumn = CreateUnsavedValidDBPrimaryKeyColumn();
            dBPrimaryKeyColumn.Save();
            return dBPrimaryKeyColumn;
        }

        /// <summary>
        /// Creates a new unsaved DBPrimaryKeyColumn with a random value assigned to every property
        /// </summary>
        public static DBPrimaryKeyColumn CreateUnsavedValidDBPrimaryKeyColumn()
        {
            DBPrimaryKeyColumn dBPrimaryKeyColumn = new DBPrimaryKeyColumn();
            dBPrimaryKeyColumn.PrimaryKeyID = TestUtilsDBPrimaryKey.CreateSavedDBPrimaryKey().PrimaryKeyID;
            dBPrimaryKeyColumn.ColumnID = TestUtilsDBColumn.CreateSavedDBColumn().ColumnID;
//			dBPrimaryKeyColumn.PendingChangeType = null;
            dBPrimaryKeyColumn.Approved = TestUtilsShared.GetRandomBoolean();
            return dBPrimaryKeyColumn;
        }
	    
        /// <summary>
        /// Creates a new unsaved DBPrimaryKeyColumn where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static DBPrimaryKeyColumn CreateUnsavedDefaultDBPrimaryKeyColumn()
        {
            DBPrimaryKeyColumn dBPrimaryKeyColumn = new DBPrimaryKeyColumn();
            return dBPrimaryKeyColumn;
        }
    }
}